// sql 语句编写
var sql = {
	username:{
		add:'insert into username(id, phone, psw) values ( null,?,?)'
	},
	user:{
		all:  'SELECT * FROM user ',
		select:'SELECT * FROM user WHERE userphone= ? AND userpasword= ?',
		add:'insert into user(id, userphone, userpasword) values ( null,?,?)',
		update:'update user set userphone=?,userpasword = ? where id =?',
		remove:'delete from user where id =?',	
		chaxun:'SELECT * FROM user WHERE userphone= ?',
		xiugai:'update user set userpasword=? where userphone=?'
	},
	regload:{
		all:  'SELECT * FROM regload ',
		select:'SELECT * FROM regload WHERE user= ? AND password= ?',
		add:'insert into regload(id, user, password) values ( null,?,?)',
		update:'update regload set user=?,password = ? where id =?',
		remove:'delete from regload where id =?'		
	},
	jiushui:{
		all:'SELECT * FROM jiushui',
		select:'SELECT * FROM jiushui WHERE src= ? AND title= ?',
		add:'insert into jiushui(src,title) values (null,?,?)',
		update:'update jiushui set src= ?,title= ? where id =?',
		remove:'delete from jiushui where id= ?'
	},
	goods:{
		all:'SELECT * FROM goods',
		select:'SELECT * FROM goods WHERE src= ? AND psw= ?',
		add:'insert into goods(src,title,price,sales,kucun,brand,fail,comments) values (null,?,?)',
		update:'update goods set src= ?,title= ?,price= ?,sales= ?,kucun= ?,brand= ?,fail= ?,comments= ? where id =?',
		priceup:'SELECT * FROM goods  order By price ',
		pricedown:'SELECT * FROM goods order by price desc',
		commentsup:'SELECT * FROM goods order by comments desc',
		sales:'SELECT * FROM goods order by sales desc'
	},
	shopping:{
		add:'insert into shopping(id, phone, src, goods,type,num, place,price,muchMoney) values ( null,?,?,?,?,?,?,?,?)'
	}
}

//返回全局共享的变量/方法 
module.exports = sql;

									